﻿using System;
using System.ComponentModel;
using System.Windows.Forms;

namespace ForTraficProject
{
    public partial class Form1 : Form
    {
        private string fileName;
        
        public Form1()
        {
            InitializeComponent();
        }

        void openFileDialog1_FileOk(object sender, CancelEventArgs e)
        {
            fileName = openFileDialog1.FileName;
        }

        private void butOpen_Click(object sender, EventArgs e)
        {
            openFileDialog1.FileOk += new CancelEventHandler(openFileDialog1_FileOk); 
            openFileDialog1.ShowDialog();   
        }
                
        private void butConvert_Click(object sender, EventArgs e)
        {
            Convertor.Convert(fileName);
        }

        void saveFileDialog1_FileOk(object sender, CancelEventArgs e)
        {
            Convertor.Save(saveFileDialog1.FileName);
        }

        private void butSave_Click(object sender, EventArgs e)
        {
            saveFileDialog1.FileOk += new CancelEventHandler(saveFileDialog1_FileOk);  
            saveFileDialog1.ShowDialog();                             
        } 
    }
}
